package com.xinruke.hostels.systemmanage.controller;

import com.xinruke.hostels.common.controller.BaseController;
import com.xinruke.hostels.common.vo.ResultVO;
import com.xinruke.hostels.common.vo.query.RowsDataVO;
import com.xinruke.hostels.system.manage.interfaces.dto.*;
import com.xinruke.hostels.systemmanage.service.WorkModeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author yutaipu
 */
@RestController
@RequestMapping("/work-mode")
@Api(tags = "交班模式")
@Slf4j
public class WorkModeController extends BaseController {

    @Autowired
    private WorkModeService workModeService;

    @PostMapping(value = "/add")
    @ApiOperation("添加")
    public ResultVO add(@RequestBody @Valid WorkModeAddDTO params){
        return workModeService.add(params);
    }

    @PostMapping(value = "/modify")
    @ApiOperation("修改")
    public ResultVO modify(@RequestBody @Valid WorkModeModifyDTO params){
        return workModeService.modify(params);
    }

    @PostMapping(value = "/delete")
    @ApiOperation("删除")
    public ResultVO delete(@RequestBody @Valid WorkModeDeleteDTO params){
        return workModeService.delete(params);
    }

    @PostMapping(value = "/list")
    @ApiOperation(value = "查询交班模式列表")
    public ResultVO<RowsDataVO<WorkModeQueryResultDTO>> list(@Valid @RequestBody WorkModeQueryListDTO params) {
        return workModeService.list(params);
    }

    @PostMapping(value = "/detail")
    @ApiOperation(value = "查询交班模式详情")
    public ResultVO<WorkModeQueryResultDTO> detail(@Valid @RequestBody WorkModeDetailDTO params){
        return workModeService.detail(params);
    }
}
